home *** CD-ROM | disk | FTP | other *** search
/ Leonardo the Inventor / Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso / LEOWINMV / SHARED.DIR / 03093_Script_OPTIMIZE < prev    next >
Text File  |  1996-04-01  |  3KB  |  111 lines

  1. -- -----------------------------------------------------------
  2. -- Handler optimizeToFrame preloads the cast members from the
  3. -- current frame to the given frame.
  4.  
  5. on optimizeToFrame toFrame, interruptFlag
  6.   waitCursor
  7.   
  8.   if interruptFlag then setAnimationInterruptable(toFrame)
  9.   
  10.   unload 1, the frame
  11.   preLoad toFrame
  12.   
  13.   normalCursor
  14. end
  15.  
  16. -- -----------------------------------------------------------
  17. -- Handler optimizeFrameToFrame preloads the cast members from
  18. -- the given fromFrame to the given toFrame.
  19.  
  20. on optimizeFrameToFrame fromFrame, toFrame, interruptFlag
  21.   waitCursor
  22.   
  23.   if interruptFlag then setAnimationInterruptable(toFrame)
  24.   
  25.   unload 1, fromFrame
  26.   preLoad fromFrame, toFrame
  27.   
  28.   normalCursor
  29. end
  30.  
  31. -- ---------------------------------------------------------------
  32. -- Handler interruptAnimation is called when the user clicked in
  33. -- the middle of an animation that was preloaded with an interruptFlag
  34. -- set to TRUE.
  35.  
  36. on interruptAnimation
  37.   global animationEndMarker
  38.   
  39.   -- if the user clicked on a sprite with a sprite script or a cast script,
  40.   -- do the script instead of going to the end animation marker.
  41.   
  42.   puppetTransition 0 -- Added by Ephraim Feb 20 96 so click kills pending transition
  43.   
  44.   if (the clickOn > 0) then
  45.     set castScript = the scriptText of cast the castnum of sprite the clickOn
  46.     set spriteScript = the scriptNum of sprite the clickOn
  47.   else
  48.     set spriteScript = 0
  49.     set castScript = EMPTY
  50.   end if
  51.   
  52.   if (castScript <> EMPTY) then
  53.     -- do the cast script  
  54.     tell the stage to do line 2 to the number of lines in castScript - 1 of castScript
  55.   end if
  56.   
  57.   if (spriteScript > 0) then
  58.     -- do the sprite script
  59.     
  60.     set spriteScriptText = the scriptText of cast spriteScript
  61.     tell the stage to do line 2 to the number of lines in spriteScriptText - 1 of spriteScriptText
  62.   end if
  63.   
  64.   set the mouseDownScript = EMPTY
  65.   
  66.   if (spriteScript = 0) and (castScript = EMPTY) then
  67.     -- get a temp value in case the next marker is also an animation
  68.     set toMarker = animationEndMarker
  69.     
  70.     -- clear the globals
  71.     set animationEndMarker = EMPTY
  72.     
  73.     go toMarker
  74.   end if
  75. end  
  76.  
  77. -- ---------------------------------------------------------------
  78. -- Handler setAnimationInterruptable sets the mouseDownScript to
  79. -- interruptAnimation to allow the current animation to be interrupted
  80. -- by a mouseclick.
  81.  
  82. on setAnimationInterruptable subSectionEnd
  83.   global animationEndMarker
  84.   
  85.   set animationEndMarker = subSectionEnd
  86.   set the mouseDownScript = "interruptAnimation"
  87. end
  88.  
  89. -- ---------------------------------------------------------------
  90. -- Handler setMouseDownScriptEmpty for animations that are not
  91. -- interrupted.
  92.  
  93. on setMouseDownScriptEmpty
  94.   set the mouseDownScript = EMPTY
  95. end
  96.  
  97. -- ---------------------------------------------------------------
  98. -- Handler endAnimation 
  99.  
  100. on endAnimation
  101.   setMouseDownScriptEmpty
  102. end
  103.  
  104. -- ---------------------------------------------------------------
  105. -- Handler endAnimationPause calls endAnimation, does not
  106. -- process the frame and stays in the frame
  107.  
  108. on endAnimationNoProcessPause
  109.   endAnimation
  110.   go the frame
  111. end